<html>
    <body>
        <a href="#one">one</a> 
        <a href="#two">two</a> 
        <a href="#three">three</a>
        <div id="visited"></div>
        <script>
            const visitedLink = document.getElementById('visited')

            window.addEventListener("hashchange", function () {
                if (location.hash === '#one') {
                  visitedLink.append('one');
                }
                if (location.hash === '#two') {
                  visitedLink.append('two');
                }
                if (location.hash === '#three') {
                  visitedLink.append('three');
                }
            })
        </script>
    </body>
</html>
